import org.pim.smart.hibernate.domain.ContactMain;
import org.pim.smart.hibernate.domain.ContactMainDAO;
import org.pim.smart.hibernate.domain.ContactSupp;
import org.pim.smart.hibernate.domain.ContactSuppDAO;
import org.pim.smart.utils.IContactConstant;


public class InsertDBContactSupp {
	
	public static void main(String[] args){
		ContactSuppDAO suppDao = new ContactSuppDAO();
		ContactMainDAO mainDao = new ContactMainDAO();
		for (int i = 1; i < 1502; i++){
			ContactMain contact = mainDao.findById(new Integer(i));
			ContactSupp supp1 = new ContactSupp();
			supp1.setContactMain(contact);
			supp1.setContactSuppType(IContactConstant.supp_datatype_tel);
			supp1.setContactSuppData("3398906");
			ContactSupp supp2 = new ContactSupp();
			supp2.setContactMain(contact);
			supp2.setContactSuppType(IContactConstant.supp_datatype_email);
			supp2.setContactSuppData("seanla@163.com");
			ContactSupp supp3 = new ContactSupp();
			supp3.setContactMain(contact);
			supp3.setContactSuppType(IContactConstant.supp_datatype_mobile);
			supp3.setContactSuppData("13988888688");
			ContactSupp supp4 = new ContactSupp();
			supp4.setContactMain(contact);
			supp4.setContactSuppType(IContactConstant.supp_datatype_address);
			supp4.setContactSuppData("Test Address");
			suppDao.save(supp1);
			suppDao.save(supp2);
			suppDao.save(supp3);
			suppDao.save(supp4);
		}
		suppDao.getSession().beginTransaction().commit();
	}
}
